package com.google.common.collect;

import java.util.Map.Entry;
import javax.annotation.Nullable;

abstract class ImmutableMapEntrySet<K, V> extends ImmutableSet<Entry<K, V>> {
    abstract ImmutableMap<K, V> map();

    ImmutableMapEntrySet() {
    }

    public int size() {
        return map().size();
    }

    public boolean contains(@Nullable Object object) {
        if (!(object instanceof Entry)) {
            return false;
        }
        Entry<?, ?> entry = (Entry) object;
        V value = map().get(entry.getKey());
        if (value == null || !value.equals(entry.getValue())) {
            return false;
        }
        return true;
    }

    boolean isPartialView() {
        return map().isPartialView();
    }
}
